package Threelayer.Utils;

import Threelayer.Entity.Person;

import java.sql.Date;
import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * @author lishunlin110
 * @version 1.0
 * @description: 给DaoUtils类提供数据
 * @date 2021/8/23 23:07
 */
public class PersonRowMapper implements RowMapper<Person>{
    @Override
    public Person getRow(ResultSet rs) {
        Person person;
        try {
            int id = rs.getInt("id");
            String name = rs.getString("name");
            String dept_name = rs.getString("dept_name");
            int tot_cred = rs.getInt("tot_cred");
            Date born = rs.getDate("bry");
            person = new Person(id,name,dept_name,tot_cred,born);
            return person;
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return null;
    }
}
